/*
 *  BinaryGreaterThanOperatorAst.cpp
 *  TempWorking
 *
 *  Created by Piotr Holc on 20/11/2010.
 *  Copyright 2010 Langerra Limited. All rights reserved.
 *
 */
#include <MAlice/Parser/location.hh>

#include <MAlice/Ast/BinaryGreaterThanOperatorAst.h>

namespace MAlice {
	
	BinaryGreaterThanOperatorAst::BinaryGreaterThanOperatorAst(location loc, ExpressionAst* lhs,
											   ExpressionAst* rhs) : BinaryOperatorAst(loc, ">", lhs, rhs) {
	MALICE_TRACE;}
	
	BinaryGreaterThanOperatorAst::~BinaryGreaterThanOperatorAst() {
		
	MALICE_TRACE;
	}
	
	llvm::Value* BinaryGreaterThanOperatorAst::generate()
	{
	MALICE_TRACE;
		llvm::Value* LHS = getLHS()->generate();
		llvm::Value* RHS = getRHS()->generate();
		
		checkType(LHS, RHS);
		
		Builder* builder = MAlice::Codegen::get()->getBuilder();
		
		return builder->CreateICmpSGT(LHS, RHS);
	}
	
}
